"""@file
   Main entry for syspyw application.
   
   @par license 
   Copyright 2012 Lu, Ken. All rights reserved.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 
   @author: Lu, Ken (bluewish.ken.lu@gmail.com)
"""

import os
import wx
import wx.lib.agw.aui as aui

import mmiopage

class syspyw_frame(wx.Frame):
    
    def __init__(self, parent):
        style=wx.DEFAULT_FRAME_STYLE|wx.SUNKEN_BORDER
        wx.Frame.__init__(self, parent, -1, style=style)

        logo_path = os.path.join(wx.GetApp().GetAppPath(), "images", "Spy.gif")
        self.SetIcon(wx.IconFromBitmap(wx.Bitmap(logo_path, wx.BITMAP_TYPE_GIF)))
        self.SetTitle(wx.GetApp().GetAppName() + " - v" + wx.GetApp().GetAppVersion())
        
        # adjust size and position
        self.SetSize((600, 500))
        self.CenterOnParent()
        
        self._manager = aui.AuiManager()
        self._manager.SetManagedWindow(self)
        
        self._create_menu_bar()
        self._manager.AddPane(self._create_main_notebook(), 
                              aui.AuiPaneInfo().Name("main_notebook").
                              CenterPane().PaneBorder(False))
        self.CreateStatusBar()
        
        self._manager.Update()
        
    def _create_menu_bar(self):
        menu_bar = wx.MenuBar()
        file_menu = wx.Menu()
        file_menu.Append(wx.ID_EXIT, "Exit")
        
        menu_bar.Append(file_menu, "&File")
        self.SetMenuBar(menu_bar)
        
    def _create_main_notebook(self):
        notebook = aui.AuiNotebook(self, -1)
        notebook.SetArtProvider(aui.AuiDefaultTabArt())
        notebook.AddPage(mmiopage.MmioPage(self), "MMIO")
        return notebook